package com.it001.filter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author 程序员恰恰
 * @date 2023-07-31 16:24
 */
@WebFilter(urlPatterns = "/usr/login", filterName = "secureFilter")
public class SecureFilter implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest servletRequest = (HttpServletRequest) request;
        //放行
        chain.doFilter(new SecureRequestWrapper(servletRequest), response);
    }
}
